// 基础类型定义
export interface BaseEntity {
  id: string;
  createdAt: string;
  updatedAt: string;
}

// 产品分类类型
export interface ProductCategory {
  id: string;
  name: string;
  level: number;
  parentId?: string;
  sort: number;
  status: 'active' | 'inactive';
  createdAt: string;
  updatedAt: string;
}

// 产品工艺类型
export interface ProductProcess {
  id: string;
  productId: string;
  name: string;
  description?: string;
  sort: number;
  createdAt: string;
  updatedAt: string;
  specifications?: ProductSpecification[];
}

// 产品参数类型
export interface ProductSpecification {
  id: string;
  productId: string;
  processId?: string;
  name: string;
  value: string;
  unit?: string;
  category?: string;
  sort: number;
  createdAt: string;
  updatedAt: string;
}

// 工艺参数类型
export interface ProcessSpecification {
  id: string;
  processId: string;
  name: string;
  value: string;
  unit?: string;
  sort: number;
  createdAt: string;
  updatedAt: string;
}

// 产品相关类型
export interface Product extends BaseEntity {
  name: string;
  type: string; // 产品类型：发光字、门头招牌、标识标牌等
  categoryId?: string; // 产品分类ID（兼容字段）
  description?: string;
  price?: string; // 价格范围文本，如"200-500元/平方米"
  priceMin?: number; // 最低价格
  priceMax?: number; // 最高价格
  unit?: string; // 计价单位：平方米、方、米、个、套等
  images: string[]; // 产品图集
  features?: string[]; // 产品特性
  tags?: string[]; // 产品标签
  craftTypes?: string[]; // 工艺类型
  specifications?: Record<string, unknown>; // 规格说明（JSON对象）
  isHot?: boolean; // 是否热门产品（兼容字段）
  featured?: boolean; // 是否推荐产品
  status: 'active' | 'inactive' | 'draft';
  sort?: number;
}

// 案例行业类型
export interface CaseIndustry {
  id: string;
  name: string;
  sort: number;
  status: 'active' | 'inactive';
  createdAt: string;
  updatedAt: string;
}

// 案例应用场景类型
export interface CaseScenario {
  id: string;
  name: string;
  industryId: string;
  sort: number;
  status: 'active' | 'inactive';
  createdAt: string;
  updatedAt: string;
}

// 案例相关类型
export interface Case extends BaseEntity {
  title: string;
  industry: string; // 行业分类：教育培训、党政机关、餐饮行业等
  category?: string; // 兼容字段，映射到industry
  description?: string;
  content?: string; // 详细内容
  industryId?: string; // 行业ID（兼容字段）
  scenarioId?: string; // 应用场景ID（兼容字段）
  applicationScenes?: string[]; // 兼容字段
  scenarios?: string[]; // 兼容字段
  images: string[]; // 案例图集
  services?: string[]; // 服务内容
  highlights?: string[]; // 项目亮点
  challenges?: string; // 技术挑战
  solutions?: string; // 解决方案
  results?: string; // 项目成果
  tags?: string[]; // 相关标签
  client?: string; // 兼容字段，映射到clientName
  clientName?: string; // 客户名称
  duration?: string; // 项目周期
  projectDate?: string; // 项目日期
  completedAt?: string; // 完成时间
  completedDate?: string; // 兼容字段
  location?: string; // 项目地点
  projectValue?: string; // 项目价值
  background?: string; // 项目背景
  requirements?: string; // 客户需求
  projectScale?: string; // 项目规模（兼容字段）
  featured?: boolean; // 是否推荐案例
  status: 'active' | 'inactive' | 'draft';
  sort?: number;
}



// 用户类型
export interface User {
  id: string;
  username: string;
  nickname: string;
  role: 'admin' | 'guest';
  avatar?: string;
  status: 'active' | 'inactive';
  lastLogin?: string;
  lastLoginAt?: string;
  createdAt: string;
  updatedAt: string;
}

// API响应类型
export interface ApiResponse<T = unknown> {
  success: boolean;
  data?: T;
  message?: string;
  code?: number;
}

// 分页类型
export interface Pagination {
  current: number;
  pageSize: number;
  total: number;
}

export interface PaginatedResponse<T> extends ApiResponse<T[]> {
  pagination: Pagination;
}

// 表单类型
export interface ContactForm {
  name: string;
  phone: string;
  company?: string;
  message: string;
}

// 联系人信息类型
export interface ContactPerson {
  id: string;
  name: string;
  position: string;
  phone: string;
  wechat?: string;
  avatar?: string;
  description?: string;
  qrCode?: string;
}

// 标签类型
export interface Tag extends BaseEntity {
  name: string;
  type?: string; // 标签类型：case, product
  color?: string; // 标签颜色
  status: 'active' | 'inactive';
  usageCount?: number; // 使用次数
}

// 轮播图类型
export interface Banner extends BaseEntity {
  title: string;
  subtitle?: string;
  image: string;
  sort?: number;
  status: 'active' | 'inactive';
}

// 网站设置类型
export interface SiteSettings {
  siteName?: string;
  siteLogo?: string;
  siteFavicon?: string;
  siteDescription?: string;
  companyName?: string;
  companyPhone?: string;
  companyEmail?: string;
  companyAddress?: string;
  wechat?: string;
  qq?: string;
  icp?: string;
  contacts?: ContactPerson[];
}

// Settings 类型别名
export type Settings = SiteSettings;

// 认证相关类型
export interface LoginRequest {
  username: string;
  password: string;
  remember?: boolean;
}

export interface LoginResponse {
  token: string;
  refreshToken: string;
  user: {
    id: string;
    username: string;
    email: string;
    role: string;
  };
  tokenExpiry: string;
}



// 仪表盘统计类型
export interface DashboardStats {
  productCount: number;
  caseCount: number;
  visitCount: number;
  conversionRate: number;
}

// 系统状态类型
export interface SystemStatus {
  cpu: number;
  memory: number;
  disk: number;
  network: {
    upload: number;
    download: number;
  };
}

// 系统日志类型
export interface SystemLog {
  id: string;
  level: 'info' | 'warn' | 'error' | 'debug';
  message: string;
  timestamp: string;
  createdAt: string;
  module?: string;
  user?: string;
  metadata?: Record<string, unknown>;
}

// 备份类型
export interface Backup {
  id: string;
  filename: string;
  size: number;
  createdAt: string;
  type: string;
}